import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    SettingViewState state, Dispatch dispatch, ViewService viewService) {
  final List<String> titles = [
//    '通知设置',
    '清除缓存',
    '版本信息',
    // '删除账号',
  ];

  Widget _groupTwo() {
    List<Widget> widgets = titles
        .map<Widget>((e) => InkWell(
              child: Container(
                height: 51,
                padding: EdgeInsets.only(left: 15, right: 15),
                decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border(
                    bottom: BorderSide(
                      color: ThemeConfig.separeColor,
                      width: 1,
                    ),
                  ),
                ),
                child: Row(
                  children: <Widget>[
                    Padding(
                      padding: EdgeInsets.only(),
                      child: Text(
                        e,
                        style: TextThemeConfig.UserCenterItemStyle,
                      ),
                    ),
                    Expanded(
                      child: Container(),
                    ),
                    e == '版本信息'
                        ? Padding(
                            padding: EdgeInsets.only(right: 8),
                            child: Text(
                              'v${ThemeConfig.version}',
                              style: TextThemeConfig.Font14WithColor66,
                            ),
                          )
                        : Container(),
                    Padding(
                        padding: EdgeInsets.only(right: 12),
                        child: Image.asset('images/right_arrow.png')),
                  ],
                ),
              ),
              onTap: () => dispatch(SettingViewActionCreator.onTap(e)),
            ))
        .toList();
    return Column(
      children: widgets,
    );
  }

  return Scaffold(
    appBar: myAppBar(viewService.context, title: '设置'),
    backgroundColor: Colors.white,
    body: Column(
      children: <Widget>[
        Container(
          height: 1,
          width: double.infinity,
          color: ThemeConfig.separeColor,
        ),
        _groupTwo(),
      ],
    ),
  );
}
